<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr=[1,2,3,4,3,2,3,2,1,4,5,6];
    //方法一
    let newArr=[...new Set(arr)];
    console.log(newArr);
    //方法二
    let temp=[];
    arr.filter(item=>{
      if(temp.indexOf(item)===-1){
        temp.push(item);
      }
    })
    console.log(temp);
  </script>
</body>
</html>